package com.szq.netty.server;

import com.szq.netty.server.common.MyServerCommonHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.SocketChannel;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName: MyServerHandler
 * @Description:
 * @Author: szq
 * @Date: 2021-11-23 13:39:42
 */
public class MyServerHandler extends MyServerCommonHandler {

    @Override
    protected void sendData(ChannelHandlerContext ctx) {
        sendFlag = true;
        ctx.writeAndFlush("111111111122222222223333333333\r\n", getChannelProgressivePromise(ctx, channel->{
            if (ctx.channel().isWritable() && !sendFlag){
                sendData(ctx);
            }
        }));
    }
}
